package com.aaronprj.school.mbooks.uivo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import com.aaronprj.common.enums.mbooks.ItemCategory;
import com.aaronprj.common.web.uivo.BaseEntity;

public class UIBookMenu extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Set<Entry<ItemCategory,List<UIBookItem>>> uiMenuItems;
	private Map<ItemCategory,List<UIBookItem>> uiMIMap;

	public void addUIItem(ItemCategory category, UIBookItem uiItem){
		if(null == uiMenuItems){
			uiMenuItems = new HashSet<Entry<ItemCategory,List<UIBookItem>>>();
			uiMIMap = new HashMap<ItemCategory,List<UIBookItem>>();
		}
		List<UIBookItem> ufis = uiMIMap.get(category);
		if(null == ufis){
			ufis = new ArrayList<UIBookItem>();
		}
		if(!ufis.contains(uiItem)){
			ufis.add(uiItem);
			uiMIMap.put(category, ufis);
			uiMenuItems= uiMIMap.entrySet();
		}
		
	}

	public Set<Entry<ItemCategory, List<UIBookItem>>> getUiMenuItems() {
		return uiMenuItems;
	}

	public void setUiMenuItems(Set<Entry<ItemCategory, List<UIBookItem>>> uiMenuItems) {
		this.uiMenuItems = uiMenuItems;
	}

	
	

}
